// 预编译
function fn(a) { 
    console.log(a);
    var a = 123;
    console.log(a);
    function a() {  }
    console.log(a);
    var b = function(){}
    console.log(b);
    function d() {  }
 }
 fn(1)
 AO:{
     a: undefined
     b:undefined

 }
// 预编译发生咋函数执行的前一刻

/* 
1. 创建AO对象(Activation Object) (执行期上下文)
2.找形参和变量声明,将变量和形参名作为Ao属性名 值为 undefined
3.将实参值和形参统一
4.在函数体里面找函数声明,值赋予函数体
 */

function test(a,b) {
    console.log(a);
    c = 0; 
    var c;
    a = 3;
    b = 2;
    console.log(b);
    function b() {  }
    function d() {  }
    console.log(b);
  }
  test(1)


  function test1(a,b) {
      console.log(a);  //fun
      console.log(b);  // undefined
      var b = 234;
      console.log(b);  // 234
      a = 123;
      console.log(a); // 123
      function a (){}
      var a;
      b = 234;
      var b = function () {}
      console.log(a); //123
      console.log(b); // fun
    }
    test1(1)


    global = 100;
    function fn1() {
        console.log(global); //undefined
        global = 200;
        console.log(global); //200
        var global = 300;
      }
      fn1();
      var global;

      function bar() {
          return foo;
          foo = 10;
          function foo() {  }
          var foo = 11;
        }
        console.log(bar()); // fun


        console.log(bar()); // 11
        function bar() { 
            foo = 10;
            function foo() {}

            var foo = 11;
            return foo;
         }



a = 100;
function dome(e) {
    function e() {  }
    arguments[0] = 2;
    console.log(e);  //2
    if (a) {
        var b = 123;
        function c() {  }
    }
    var c;
    a = 10;
    var a;
    console.log(b); //undefined
    f = 123;
    console.log(c); //undefined
    console.log(a)  // 10
  }
  var a;
  dome(1);
  console.log(a); //100
  console.log(f); //123






// 函数声明整体提升
// 变量  声明提升

// 声明的变量归Window所有
// 一切声明的全局变量 全是windowde 属性 /


var str = false + 1;
console.log(str);
var dome = false == 1;
console.log(dome);
if (typeof(a) && -true + (+undefined) + "") {
    console.log("基础扎实");
}
if (11 + "11" * 2 == 33) {
    console.log("基础扎实");
}
!!" " + !!"" - !!false || console.log('你觉得能打印, 你就是猪')

(window.foo || (window.foo = 'bar'))
